<template>
    <div class="uiLogin">
        <div class="login">
            <div class="imgage">
                <img :src="loginImg" alt="">
            </div>
            <div class="form">
                <div class="sysTitle">{{sys.info.sysTitle}}</div>
                <div class="edits">
                    <div class="r">
                        <el-input v-model="login.uid" placeholder="请输入用户名"></el-input>
                        <div class="lab">用户名</div>
                        <i class="fa fa-user-circle-o editIcon"></i>
                    </div>
                    <div class="r">
                        <el-input v-model="login.pwd" placeholder="请输入密码" type="password"></el-input>
                        <div class="lab">密码</div>
                        <i class="fa fa-lock editIcon"></i>
                    </div>
                </div>
                <div class="postBtns">
                    <el-button type="text">忘记密码</el-button>
                    <el-button type="primary" @click="acLogin">
                        <i class="fa fa-check"></i> 登录系统
                    </el-button>
                </div>
            </div>
        </div>
        <div class="copyright">copy right @ {{sys.info.copyRight}}</div>
    </div>
</template>

<script>
export default {
  data () {
    return {
      loginImg: require('../assets/imgs/bg/quashbg.jpg'),
      login: {
        uid: '',
        pwd: ''

      }
    }
  },
  methods: {
    acLogin () {
      var me = this
      try {
        console.log(me.login)
        me.sys.query('squ/checkLogin', { code: me.login.uid, pwd: me.login.pwd }).then(res => {
          // console.log(res);
          if (res && res.length > 0) {
            var userData = JSON.stringify(res[0])
            window.sessionStorage.setItem('squLogin', userData)
            me.$router.push({
              path: 'adm'
            })
          } else {
            me.$message.error('用户名或密码错误！')
          }
        })
      } catch (er) {
        console.log(er)
      }
    }
  }
}
</script>

<style lang="less" scoped>
    .uiLogin{
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 1000px;
        .login{
            display: flex;
            background-color: #fff;
            .imgage{
                flex: 3;
                img{
                    width: 100%
                }
            }
            .form{
                flex: 2;
                padding: 25px;
                .sysTitle{
                    color: #0077fe;
                    font-weight: bold;
                    font-size: 2em;
                    text-align: center;
                    padding: 10px 0;
                    margin-bottom: 20px;
                }

                .edits{
                    margin-bottom: 20px;
                    .r{
                        position: relative;
                        ::v-deep .el-input__inner{
                            padding-left: 80px;
                            padding-right: 45px;
                            margin-bottom: 15px;
                        }
                        .lab{
                            position: absolute;
                            left: 15px;
                            top: 10px;
                        }
                        .editIcon{
                            position: absolute;
                            right: 15px;
                            top: 0;
                            height: 40px;
                            line-height: 40px;
                        }
                    }
                }

                .postBtns{
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                }
            }
        }

        .copyright{
            padding: 15px 0;
            text-align: center;
            color: #777;
            text-shadow: 1px 1px 1px #fff;
        }
    }
</style>
